package 手写Interceptor;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chedx
 * @data 2021/3/21 3:36 PM
 */
public class HandleExecutionChain {
    private List<HandlerInterceptor> list = new ArrayList<>();

    public void addInterceptor(HandlerInterceptor interceptor) {
        list.add(interceptor);
    }

    public boolean applyPrehandler() {
        for (int i = 0; i < list.size(); i++) {
            if(!list.get(i).preHandler()){
                return false;
            }
        }
        return true;
    }
}
